home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-04 | 2.2 KB | 67 lines | [TEXT/CWIE] |
- // C3DMFViewerPane.h
- //
- // A PowerPlant application for viewing QuickDraw3D Metafiles
- //
- // by James Jennings
- // Started November 12, 1995
- //
- /*
- Some lessons learned:
- It's best to use Q3ViewerEvent() for mouse events and
- Q3ViewerDraw() when responding to update events.
- You can pass updates to Q3ViewerEvent() but this won't
- erase the frame (if recently turned off) and PP has no
- convenient hooks for it (without overriding
- LApplication::DispatchEvent().)
- We must call FocusDraw() before calling Q3ViewerEvent()
- (to set the port), otherwise, the mouse tracking is funny.
- We don't seem to need to pass activateEvt's.
-
- The QD3D documentation says to ask Q3ViewerEvent() to handle
- every event, and then to only handle what it declines.
- I wasn't able to easily do that as part of the PP framework
- but what I did do seems to work.
- */
-
- #pragma once
-
- #include <LPane.h>
- #include <QD3DViewer.h>
-
- // Declare the Pane ID here so it can be seen by the Doc and the App.
- // (Makes things less portable?)
- const PaneIDT PaneID_Q3Viewer = 100;
-
- class C3DMFViewerPane : public LPane, LCommander {
- public:
- enum { class_ID = 'Q3vc' }; // Note: Viewer gestalt selector is 'q3vc'
- static C3DMFViewerPane* CreateQ3ViewerPaneStream(LStream *inStream);
- C3DMFViewerPane(LStream *inStream);
- virtual ~C3DMFViewerPane(void);
-
- // viewer related methods
- void UseFile(Int16 refNum);
- virtual void ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta,
- Boolean inRefresh);
- virtual void MoveBy(Int32 inHorizDelta, Int32 inVertDelta,
- Boolean inRefresh);
- protected:
- virtual void ClickSelf(const SMouseDownEvent &inMouseDown); // mouseDown
- // virtual void EventMouseUp(const EventRecord &inMacEvent); // not needed?
- virtual void DrawSelf(); // update
- virtual void AdjustCursorSelf(Point inPortPt, // mouse moved
- const EventRecord &inMacEvent);
-
- public:
- // commander methods
- virtual Boolean ObeyCommand(CommandT inCommand, void *ioParam);
- virtual void FindCommandStatus(CommandT inCommand,
- Boolean &outEnabled, Boolean &outUsesMark,
- Char16 &outMark, Str255 outName);
- protected:
- Boolean Has3DViewer();
- TQ3ViewerObject mViewer;
- // helper function: used in ResizeFrameBy() and MoveBy()
- void FitViewerToPane(void);
- };
-